/*
 
 TopMind jLynx
 Copyright (c) 2004-onwards. TopMind Systems LLC.
 All rights reserved.
 
 This file is part of TopMind jLynx.
 
 TopMind jLynx is free software; you can redistribute it and/or modify
 it under the terms of the License. See website for License.
 
 */
package org.rishi.framework.db;

import java.math.BigDecimal;
import java.sql.Types;
import java.util.Map;
import java.util.TreeMap;

/**
 * 
 * @author MHT E-mail:mht1984@126.com
 * @version 创建时间：2010-8-31 下午05:02:58
 *
 */
class DataTypeMappings {

    public static java.util.Map TYPE_MAPPINGS;

    protected static boolean isNumber(Object obj) {

        return obj instanceof Integer || obj instanceof BigDecimal || obj instanceof Double || obj instanceof Long;

    }

    static {

        Map tm = new TreeMap();
        tm.put(new Integer(Types.BIT), "boolean");

        tm.put(new Integer(Types.BLOB), "java.sql.Blob");
        tm.put(new Integer(Types.CLOB), "java.sql.Clob");

        tm.put(new Integer(Types.DATE), "java.sql.Date");
        tm.put(new Integer(Types.TIME), "java.sql.Time");
        tm.put(new Integer(Types.TIMESTAMP), "java.sql.Timestamp");

        tm.put(new Integer(Types.VARCHAR), "String");
        tm.put(new Integer(Types.CHAR), "String");
        tm.put(new Integer(Types.LONGVARCHAR), "String");

        tm.put(new Integer(Types.INTEGER), "Integer");
        tm.put(new Integer(Types.TINYINT), "Integer");
        tm.put(new Integer(Types.SMALLINT), "Integer");

        tm.put(new Integer(Types.BIGINT), "long");

        tm.put(new Integer(Types.NUMERIC), "java.math.BigDecimal");
        tm.put(new Integer(Types.DECIMAL), "java.math.BigDecimal");

        tm.put(new Integer(Types.REAL), "float");

        tm.put(new Integer(Types.FLOAT), "double");
        tm.put(new Integer(Types.DOUBLE), "double");

        TYPE_MAPPINGS = tm;

    }

}